﻿using LdtJudge.DataEngine.Model.DataModel.DataParseStorage;
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Ldt.WindowsFormsApp
{
    public partial class ParagraphDataFrom : UIForm
    {
        public ParagraphDataFrom(object datamodel)
        {
            InitializeComponent();
            paragraphDataGridView.DataSource = datamodel;
        }

        private void paragraphDataGridView_SelectionChanged(object sender, EventArgs e)
        {
            DataGridViewRow row = paragraphDataGridView.CurrentRow;
            if(row!=null && row.DataBoundItem!=null)
            {
                var duanluo = row.DataBoundItem as An_duanluo;
                originalRichTextBox.Text = string.Empty;
                regCodeRichTextBox.Text = string.Empty;
                if (!string.IsNullOrWhiteSpace(duanluo.Duanluoyuanwen))
                    originalRichTextBox.Text = duanluo.Duanluoyuanwen;
                if (!string.IsNullOrWhiteSpace(duanluo.Duanluobianhao))
                    regCodeRichTextBox.Text = duanluo.Duanluobianhao;

            }
        }
    }
}
